package com.liuyang.utils;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class MapCacheManagerUtils {

    private volatile static MapCacheManagerUtils mapCacheObject;// 缓存实例对象

    private Map cacheMap = new ConcurrentHashMap();// 缓存容器
    private String userAccount;

    private MapCacheManagerUtils() {
    }

    /**
     * 采用单例模式获取缓存对象实例
     *
     * @return
     */
    public static MapCacheManagerUtils getInstance() {
        if (null == mapCacheObject) {
            synchronized (MapCacheManagerUtils.class) {
                if (null == mapCacheObject) {
                    mapCacheObject = new MapCacheManagerUtils();
                }
            }
        }
        return mapCacheObject;
    }

    /**
     * 返回缓存对象
     *
     * @return
     */
    public Map getMapCache() {
        return this.cacheMap;
    }

    /**
     * 设置缓存对象
     * @param map
     */
    public void setMapCache(Map map) {
        this.cacheMap = map;
    }

    public String getUserAccount() {
        return userAccount;
    }

    public void setUserAccount(String userAccount) {
        this.userAccount = userAccount;
    }
}
